//
//  OtherCollectionViewCell.m
//  Movie
//
//  Created by cjy on 16/3/30.
//  Copyright © 2016年 HY. All rights reserved.
//

#import "OtherCollectionViewCell.h"
//#import "OtherModel.h"
#import "MovieModel.h"
#import <UIImageView+WebCache.h>
@implementation OtherCollectionViewCell


- (instancetype)initWithFrame:(CGRect)frame{

    self = [super initWithFrame:frame];
    
    
    if (self) {
        
        
        self.imageV = [[UIImageView alloc]init];
        [self.contentView addSubview:self.imageV];
        
        self.name = [[UILabel alloc]init];
        [self.imageV addSubview:self.name];
        
    }

    return self;

}


- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes{
    

    self.imageV.frame = CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height);

    self.name.frame = CGRectMake(30 , self.contentView.frame.size.width/3+10 , self.contentView.frame.size.width - 40, 30);

}

- (UICollectionViewLayoutAttributes *)preferredLayoutAttributesFittingAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes{


    return layoutAttributes;

}

- (void)layoutSubviews{
    
    [super layoutSubviews];
    
}

//- (void)passModel:(OtherModel *)model{

- (void)passModel:(MovieModel *)model{
    [self.imageV sd_setImageWithURL:[NSURL URLWithString:model.coverForDetail] placeholderImage:[UIImage imageNamed:@"zwt"]];
    
    self.name.textColor =[UIColor whiteColor];
    self.name.text = [NSString stringWithFormat:@"# %@",model.title];
    self.name.center = self.imageV.center;
    self.name.textAlignment = NSTextAlignmentCenter;
    self.name.font = [UIFont boldSystemFontOfSize:18];
    self.name.shadowColor = [UIColor blackColor];
    self.name.shadowOffset = CGSizeMake(0.3, 0.2);
}
@end
